{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Notebook preparation\n",
    "\n",
    "This notebook was designed to run the [QIIME Illumina Overview Tutorial](http://qiime.org/tutorials/illumina_overview_tutorial.html) on the QIIME 1.9.1 Amazon Web Services EC2 instance. You can find the AMI ID on the [QIIME resources page](http://qiime.org/home_static/dataFiles.html). These steps covered here are important for having multiple users working on a single IPython Notebook server, but are a little bit of overkill if you're running this on your own AWS instance. If you're running this on your own instance, you should instead work with the IPython Notebook linked from [here](http://qiime.org/tutorials/illumina_overview_tutorial.html#ipython-notebook)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Getting started\n",
    "\n",
    "We'll begin by initializing some variables to configure our IPython computing environment. Don't edit anything in this first cell. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from random import choice\n",
    "from os import chdir, mkdir, makedirs\n",
    "from os.path import join\n",
    "from IPython.display import FileLinks, FileLink\n",
    "from functools import partial\n",
    "\n",
    "# to support running in a multi-user environment, each user will work in\n",
    "# a temporary working directory with a randomly generated name\n",
    "basedir = \"temp\"\n",
    "choices = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n",
    "choices += choices.lower()\n",
    "working_dir = join(basedir,''.join([choice(choices) for i in range(12)]))\n",
    "\n",
    "print \"Your working directory is %s\" % working_dir\n",
    "makedirs(working_dir)\n",
    "chdir(working_dir)\n",
    "\n",
    "!wget ftp://ftp.microbio.me/qiime/tutorial_files/moving_pictures_tutorial-1.9.0.tgz\n",
    "!tar -xzf moving_pictures_tutorial-1.9.0.tgz\n",
    "\n",
    "chdir('moving_pictures_tutorial-1.9.0/illumina')\n",
    "FileLink = partial(FileLink, url_prefix=join(working_dir, 'moving_pictures_tutorial-1.9.0/illumina/'))\n",
    "FileLinks = partial(FileLinks, url_prefix=join(working_dir, 'moving_pictures_tutorial-1.9.0/illumina/'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Running the Illumina Overview Tutorial\n",
    "\n",
    "You can now get started. Follow the steps found in the [Illumina Overview Tutorial](http://qiime.org/tutorials/illumina_overview_tutorial.html). You should begin with the steps under **Check our mapping file for errors** (the **Getting Started** steps have already been completed when you executed the steps above)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
